package site.psvm.phoneinfo.common.bean.dto;

import java.io.Serializable;
import java.util.List;

/**
 * @author yonson
 * @param <T>
 */
public class ListDto<T> extends ActionResult implements Serializable {
	
	/**
     * list数据
     */
    private List<T> list;

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public <K>ListDto<K> ok(List<K> list){
		ListDto<K> listDto = new ListDto<>();
		listDto.setResultCode("001");
		listDto.setResultMsg("操作成功");
		listDto.setList(list);
		return listDto;
	}

	public <T>ListDto<T> error(String...msg){
		ListDto<T> listDto = new ListDto<>();
		listDto.setResultCode("000");
		if (msg!=null && msg.length>0) {
			listDto.setResultMsg(msg[0]);
		}else {
			listDto.setResultMsg("操作失败");
		}
		return listDto;
	}

}
